package net.stratusprogramming.school.Game.Battle.GUI;

import net.stratusprogramming.school.Game.Framework.Scene.Actor;
import net.stratusprogramming.school.Game.Framework.System.SaveMgr;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;

/**
 * A GUI item for a bar (health, mana, etc)
 * 
 * @author Dominic Vitello, Patrick Lienau
 * @since 5/10/12
 * @version 0.1
 */
public class Bar extends Actor {

	/** The color of the border */
	private static final Color BORDER_COLOR = Color.black; 

	/** The color of the inside of the bar */
	private Color barColor;
	/** The current value of the bar */
	private float value;
	/** The maximum value of the bar */
	private float total;

	/**
	 * Creates a new color
	 * 
	 * @param color color of the bar
	 */
	public Bar(Color color)	{
		this.barColor = color;
	}


	@Override
	public void update(int delta) {
		// TODO Auto-generated method stub

	}

	@Override
	/**
	 * @param g Graphics
	 */
	public void render(Graphics g) {
		g.setColor(BORDER_COLOR);
		g.drawRect(x, y, width, height);

		if(value != 0) {
			g.setColor(barColor);		
			float emptyWidth = width-1;
			g.fillRect(x+1, y+1, (value/total)*emptyWidth, height-1);
		}
	}

	@Override
	public void save(SaveMgr saveMgr) {
		// TODO Auto-generated method stub

	}

	@Override
	public void load(SaveMgr saveMgr) {
		// TODO Auto-generated method stub

	}

	/**
	 * @return the value
	 */
	public float getValue() {
		return value;
	}

	/**
	 * @param value the value to set
	 */
	public void setValue(float value) {
		this.value = value;
	}

	/**
	 * @return the total
	 */
	public float getTotal() {
		return total;
	}

	/**
	 * @param total the total to set
	 */
	public void setTotal(float total) {
		this.total = total;
	}

	/**
	 * @return the barColor
	 */
	public Color getBarColor() {
		return barColor;
	}

	/**
	 * @param barColor the barColor to set
	 */
	public void setBarColor(Color barColor) {
		this.barColor = barColor;
	}	
	
	
}
